import request from '@/utils/request'
import type { PageDto, PageReqDto, PagesDto } from '../types'
import type { AddPlanNumberReqDto, EditPlanNumberReqDto, InsureCompanyPlanDetailDto, InsureCompanyPlanListReqDto, InsureCompanyPlanNumberDto } from './types'
/**
 * 保司方案列表
 * @param params 
 * @returns 
 */
export function getInsureCompanyPlanList(params: PageReqDto & InsureCompanyPlanListReqDto): Promise<PageDto<InsureCompanyPlanDetailDto>> {
    return request.get('/crm-prod-v2/web/pc/crm/insureCompanyPlan/list', {
        params
    })
}

/**
 * 保司方案保单号列表
 * @param params 
 * @returns 
 */
export function getInsureCompanyPlanNumberList(params: PageReqDto & {
    insureCompanyId?: number
    effectTimeStart?: string
    effectTimeEnd?: string
    orderByColumn?: string
    isAsc?: 'desc' | 'asc'
}): Promise<PageDto<InsureCompanyPlanNumberDto>> {
    return request.get('/crm-prod-v2/web/pc/crm/insureCompanyPlanNumber/queryPageList', {
        params
    })
}

/**
 * 新增保单号相关
 * @param data 
 * @returns 
 */
export function addPlanNumber(data: AddPlanNumberReqDto): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyPlanNumber/addPlanNumber', data)
}

/**
 * 编辑保单号相关
 * @param data 
 * @returns 
 */
export function editPlanNumber(data: EditPlanNumberReqDto): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyPlanNumber/updatePlanNumber', data)
}

/**
 * 删除保单号
 * @param data 
 * @returns 
 */
export function deletePlanNumber(data: {
    id: number
}): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyPlanNumber/deletePlanNumber', data)
}
